var Static = (function() {
    var constants = {
        "introduce":"/aifish/views/introduce.html"
    }
    var PAGE = {};
    PAGE.getConstantPage=function(name){
        return constants[name];
    }
    return PAGE;
})();

$(document).on('pjax:start', function() {
    NProgress.start();
});
$(document).on('pjax:end', function() {
    NProgress.done();
});
$(document).on('pjax:complete', function() {
    $('pre code').each(function(i, e) {hljs.highlightBlock(e)});
});
$(document).on("pjax:timeout", function(event) {
    event.preventDefault(); // 阻止超时导致链接跳转事件发生
});
$(document).pjax('li.ant-menu-item > a', '#pjax-container');
//$.pjax({url: Static.getConstantPage("introduce"), container: '#pjax-container'})


$(function(){
    $(".aside-container li.ant-menu-item").hover(
      function () {
        $(this).addClass("ant-menu-item-active");
      },
      function () {
        $(this).removeClass("ant-menu-item-active");
      }
    );
    $(".aside-container li.ant-menu-item").on('click',function(){
        $(".ant-menu-item-selected").removeClass("ant-menu-item-selected");
        $(this).addClass("ant-menu-item-selected");
    })
    $(".aside-container .ant-menu-submenu-title").on('click',function(){
        var $thiz = $(this).parents(".ant-menu-submenu");
        if($thiz.hasClass("ant-menu-submenu-open")){
            $thiz.removeClass("ant-menu-submenu-open").addClass("ant-menu-submenu-close");
            //alert(2);
            $thiz.find("ul.ant-menu-sub").addClass('ant-menu-hidden');
        }else{
           // alert(3);
            $thiz.removeClass("ant-menu-submenu-close").addClass("ant-menu-submenu-open");
            $thiz.find("ul.ant-menu-sub").removeClass('ant-menu-hidden');
        }
    })
})
/*
$(function(){
    // 默认加载介绍页面
    Common.loadHtml(Static.getConstantPage("introduce"))

    // 绑定菜单栏点击事件
    $(".ant-menu .ant-menu-item").each(function(){
        $(this).find("a").click(function(){
            Common.loadHtml($(this).data("href"));
        })
    })
})

var Common = {
    $container:"#JS_MAIN_CONTAINER",
    loadHtml:function(href){
        var self = this;
        NProgress.start();
        $.ajax({
            url: href,
            cache: false,
            success: function(html){
                setTimeout(function(){
                    NProgress.done();
                },500);
                $(self.$container).html(html);
           }
        });
    }
}

*/